package constant

import (
	"strconv"
	"time"

	gocache "github.com/patrickmn/go-cache"
)

const (
	// jwt负载信息
	JwtKeyUserInfo     = "user"
	JwtKeyUserId       = "userId"
	JwtKeyUserName     = "username"
	JwtKeyUserRoleIds  = "roleIds"
	JwtKeyUserRoleName = "roleName"
	JwtKeyUserDeptIds  = "deptIds"
	JwtKeyUserDeptName = "deptName"
	JwtKeyAgencyId     = "agency"
	JwtKeyAppId        = "appId"
	// 默认分组id
	DefaultGroupId = "root"
	// 已处理消息主题
	HandledMsgTopic = "/san/data/handle"
	// 设备登录登出
	LoginMsgTopic  = "/san/event/device/login"
	LogoutMsgTopic = "/san/event/device/logout"
	// 转发配置缓存
	ForwardConfigKey = "forward_config:"
	// 转发统计缓存
	ForwardClientPrefix    = "ForwardDetail:"
	ForwardClientLastTime  = "lastTime"
	ForwardClientStatus    = "status"
	ForwardClientSendCount = "count"
	// 设备操作消息主题
	DeviceDeleteMsgTopic = "/san/event/device/delete"
	DeviceAddMsgTopic    = "/san/event/device/add"
	// 自动建表默认表名
	AutoTableName = "t_sansan_forward"
	// 敏感内容加密加盐
	SALTKEY = "ssiot_aes_len_16"
	// http url后缀
	UrlSuffixField = "url_suffix"
)

var (
	//配置文件
	ConfigFile = "config/settings.yml"
	// 本地缓存
	LocalCache = gocache.New(10*time.Second, 3*time.Second)
	// 避免多个部署相互踢
	MqttNumber = strconv.FormatInt(time.Now().UnixMilli(), 10)
)
